package com.huawei.control.phonesinfo;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huawei.bean.Phones;

import com.huawei.model.PhoneInfoModel;
import com.huawei.model.UserInfoModel;
import com.huawei.utils.EasyFactory;

@WebServlet("/PhonesInfoAjaxModifyControl")
public class PhonesInfoAjaxModifyControl extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 接收前台form表单的数据
		// 从request中获取id主键值
		String strPhoneId = request.getParameter("pid");		
		// 调用model层查询该id的所有的记录信息
		Phones phone = EasyFactory.getNewInstance(PhoneInfoModel.class).queryPhoneInfoById(strPhoneId);
		// 将查询结果缓存到session中
		request.getSession().setAttribute("Phones", phone);
		// 跳转到修改页面
		request.getRequestDispatcher("WEB-INF/pages/phonesinfo/PhonesInfoModify.jsp").forward(request, response);
		
	}

}